using Business.AreaManagement;
using Business.BookManagement;
using Business.BookManagement.Dto;
using Business.WarehouseAreaManagement;
using Business.WarehouseManagement;
using Business.WarehouseManagement.Dto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace Business.Controllers
{
    [RemoteService]
    [Area("Business")]
    [Route("api/business/Warehouse")]
    public class WarehouseController : AbpController
    {
        private readonly IWarehouseAppService _warehouseAppService;
        private readonly IAreaAppService _areaAppService;
        private readonly IWarehouseAreaAppService _warehouseAreaAppService;


        public WarehouseController(IWarehouseAppService warehouseAppService, IAreaAppService areaAppService, IWarehouseAreaAppService warehouseAreaAppService)
        {
            _warehouseAppService = warehouseAppService;
            _areaAppService = areaAppService;
            _warehouseAreaAppService = warehouseAreaAppService;
        }

        [HttpPost]
        [Route("data-post")]
        public Task<WarehouseDto> CreateOrUpdate(CreateOrUpdateWarehouseDto input)
        {
            return _warehouseAppService.CreateOrUpdate(input);
        }

        [HttpPost]
        [Route("delete")]
        public Task Delete(List<Guid> ids)
        {
            return _warehouseAppService.Delete(ids);
        }

        [HttpGet]
        [Route("{id}")]
        public Task<WarehouseDto> Get(Guid id)
        {
            return _warehouseAppService.Get(id);
        }

        [HttpGet]
        public Task<PagedResultDto<WarehouseDto>> GetAll(GetWarehouseInputDto input)
        {
            return _warehouseAppService.GetAll(input);
        }

        [HttpGet]
        [Route("data")]
        public async Task <TreeTypeDto > GetTreeData()
        {
            return await _warehouseAppService.GetTreeType();
        }

        [Route("sdsdsd")]
        [HttpGet]
        public Task<List<WarehouseDto>> GetNewAll()
        {
            return _warehouseAppService.GetNewAll();
        }
    }
}
